home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: newing char**
- Date: 11 Feb 1996 11:16:20 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4fkj64$mpl@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe10.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Feb 09, 1996 22:03:01 in article <newing char**>, 'jono@cse.ucsc.edu
- (Jonathan Gibbs)' wrote:
-
-
- >If I have the following declaration:
- >
- >char **name;
- >
- >The following line compiles fine with g++, but I get the following
- >error on SGI's CC. Which is right?
- >
- >int num;
- >name = new (char*)[num];
- ^^^^^^^^^^^^^^^^^^^^^
- Don't you get a compiler error here?
- It should be: name = new char*[num];
- >for (int i=0; i < num; i++) {
- >name = new char[25];
- ^^^^^^^^^^^^^^^^^^^
- name[i] = new char[25];
-
- >}
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-